<template>
    111
    <el-select v-model="currentLocale" @change="changeLanguage">
        <el-option label="中文" value="zh-CN" />
        <el-option label="English" value="en-US" />
    </el-select>
    <p>{{ $t('message.hello') }}</p>
    <el-button type="primary">{{ $t('message.hello') }}</el-button>
</template>

<script>
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
export default {
    setup() {
        const { locale } = useI18n();

        const currentLocale = ref(locale.value);

        const changeLanguage = (lang) => {
            locale.value = lang;
        };

        return {
            currentLocale,
            changeLanguage
        };
    }
};
</script>
